package com.java.util;

import java.util.Collection;
import java.util.Map;
import java.util.UUID;

public class MyTools {

    public static String getUUID(){
        String uuid =  UUID.randomUUID().toString().replaceAll("-", "");
        return uuid;
    }

    public static boolean isEmpty(Object pObj) {
        if (pObj == null)
            return true;
        if (pObj == "" || pObj.equals("null"))
            return true;
        if (pObj instanceof String) {
            if (((String) pObj).length() == 0) {
                return true;
            }
        } else if (pObj instanceof Collection) {
            if (((Collection<?>) pObj).size() == 0) {
                return true;
            }
        } else if (pObj instanceof Map) {
            if (((Map<?, ?>) pObj).size() == 0) {
                return true;
            }
        }
        return false;
    }
}
